﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>项目阶段信息</title>
    <link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../themes/icon.css" rel="stylesheet" type="text/css" />

    <script src="../JScript/jquery-1.6.min.js" type="text/javascript"></script>

    <script src="../JScript/jquery.easyui.min.js" type="text/javascript"></script>

    <script src="../JScript/easyui-lang-zh_CN.js" type="text/javascript"></script>

    <!-- <script src="../JScript/AutoResize.js" type="text/javascript"></script>-->

    <script src="../JScript/JSUtility.js" type="text/javascript"></script>

<!--    <script src="JScript/ProjectPhase.js" type="text/javascript"></script>-->

    <script type="text/javascript">
        var contractsId;
        var projectId;
        var projectName;
        $(function() {
            if (self.parent.projectInfoManager) {
                contractsId = self.parent.parent.public_ids.options["ProjectProgressId"];
                projectId = self.parent.parent.public_ids.options["ProjectId"];
                projectName = self.parent.parent.project_Name;
            } else {
                contractsId = self.parent.public_ids.options["ProjectProgressId"];
                projectId = self.parent.public_ids.options["ProjectId"];
                projectName = self.parent.project_Name;
            }
            $("#projectNum").html(projectId);
            $("#projectName").html(projectName);
            TreeUtility.param.ClassName = "OA.Bll.Project.ProjectPhasePresenter";
            TreeUtility.treeUrl = "../Handler/AjaxTreeHandler.ashx?projectProgressId=" + contractsId + "&InternalType=0";

            TreeUtility.param.Options["InternalType"] = "0";
            TreeUtility.window_combobox = $("#ParentId");
            TreeUtility.window_edit_form = $("#form_stage");
            TreeUtility.window_tree = $("#tt");
            //TreeUtility.comboboxUrl = "../../Handler/AjaxTreeHandler.ashx?type=combobox&InternalType=0";
//            TreeUtility.comboboxInitial();
            TreeUtility.loadTree();
            $("#btnSaveInfo").bind("click", treeCheckSave);
        });
        function treeCheckSave() {
            var checkNode = $("#tt").tree("getChecked");
            var param = { AssemblyName: "OA.Bll.Project", ClassName: "OA.Bll.Project.ProjectPhaseMappingPresenter", Method: "Edit", Options: {} };
            param.Options["node"] = "";
            $.each(checkNode, function(i, item) {
                param.Options["node"] += item.id + ",";
            });
            param.Options["node"] = param.Options["node"].toString().substring(0, param.Options["node"].length - 1);
            param.Options["ProjectProgressId"] = contractsId;
            //param.Options["nodes"] = checkNode;
            $.ajax({
                type: "post",
                url: "../Handler/AjaxHandle.ashx",
                data: $.toJSON(param),
                dataType: "json",
                success: function(data) {
                    if (data.flag) {
                        $("#tt").tree("reload");
                        $.messager.show({ msg: data.msg, title: "info" });
                        //$.messager.alert('提示', data.msg, 'info');
                    } else {
                        $.messager.alert('错误', data.msg, 'error');
                    }
                }
            });
        }
    </script>

    <style type="text/css">
        body
        {
            margin: 1px;
            padding-top: 10px;
            font-size: 12px;
            font-family: 微软雅黑;
        }
        #stageInfo
        {
            width: 100%;
            height: 100%;
        }
        #stageInfo .left
        {
            float: left;
            height: 100%;
        }
        #stageInfo .right
        {
            float: left;
            height: 100%;
        }
        #stage_menu
        {
            float: left;
        }
        #tab_stageinfo
        {
            margin-bottom: 10px;
        }
        #tab_stageinfo input
        {
            width: 200px;
        }
        #tab_stageinfo td
        {
            padding-left: 35px;
            padding-top: 5px;
        }
        #projectInfo
        {
            float: left;
            width: 100%;
            color: Gray;
            margin-bottom: 20px;
        }
        #projectInfo span
        {
            font-weight: bold;
            color: Red;
        }
    </style>
</head>
<body>
    <div id="stageInfo">
        <div id="projectInfo">
            当前选择项目信息:<span style="color: Black;">项目编号：</span><span id="projectNum">2012-10-16-0001</span><span
                style="color: Black;">，项目名称：</span><span id="projectName">测试项目</span></div>
        <div class="left">
            <fieldset id="left_fieldset">
                <legend>项目阶段信息树状列表</legend>
                <ul id="tt">
                </ul>
                <a href="javascript:void(0)" id="btnSaveInfo" style="margin-left: 20%; margin-top: 20px;
                    margin-bottom: 10px;" class="easyui-linkbutton" iconcls="icon-save">保存</a>
            </fieldset>
        </div>
        <div class="right">
            <fieldset id="right_fieldset">
                <legend>项目阶段信息</legend>
                <form id="form_stage" method="post" action="">
                <table cellpadding="0" cellspacing="0" id="tab_stageinfo">
                    <tr>
                        <td>
                            阶段名称：
                        </td>
                        <td>
                            <input id="Name" name="Name" type="text" class="easyui-validatebox" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            描述：
                        </td>
                        <td>
                            <textarea id="Description" name="Description" style="width: 200px; height: 50px;"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            阶段父级：
                        </td>
                        <td>
                            <!-- <select id="ParentId" name="ParentId" class="easyui-combobox" editable="true" style="width: 205px;">
                                 </select>-->
                                  <select id="ParentId" name="ParentId" class="easyui-combotree"  url="../Handler/AjaxTreeHandler.ashx?InternalType=0" editable="true" style="width: 205px;">
                                  </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            排序：
                        </td>
                        <td>
                            <input type="text" id="OrderId" name="OrderId" class="easyui-numberbox" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2" style="padding-top: 5px;">
                            <a class="easyui-linkbutton" href="javascript:void(0)" onclick="TreeUtility.add();"
                                iconcls="icon-add">添加</a> <a class="easyui-linkbutton" onclick="TreeUtility.update();"
                                    href="javascript:void(0)" iconcls="icon-edit">修改</a> <a class="easyui-linkbutton"
                                        href="javascript:void(0)" onclick="JSUtility.del();" iconcls="icon-remove">删除</a>
                            <a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#form_stage').form('clear');">
                                重置</a>
                        </td>
                    </tr>
                </table>
                </form>
            </fieldset>
        </div>
    </div>
</body>
</html>
